/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package isd.general.modelo;

import isd.ventas.modelo.VT_Cliente;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "grttra")
public class GR_Transporte implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "GRTTRA_TRACOD", nullable = false, length = 6)
    private String tracod;
    @Basic(optional = false)

    //Descripcion
    @Column(name = "GRTTRA_DESCRP", nullable = false, length = 60)
    private String descrp;

    //Direccion
    @Column(name = "GRTTRA_TRADIR", length = 60)
    private String tradir;

    //Pais 
    @JoinColumn(name = "GRTTRA_CODPAI", referencedColumnName = "GRTPAH_CODPAI", nullable = false, insertable=false, updatable=false)
    @ManyToOne
    private GR_Pais pais;

    //Codigo postal
    @JoinColumns({
        @JoinColumn(name = "GRTTRA_CODPOS", referencedColumnName = "GRTPAC_CODPOS", nullable = false),
        @JoinColumn(name = "GRTTRA_CODPAI", referencedColumnName = "GRTPAC_CODPAI", nullable = false)
    })
    @ManyToOne
    private GR_CodigoPostal codigoPostal;
    
    //Tipo documento
    @JoinColumn(name = "GRTTRA_TIPDOC", referencedColumnName = "GRTDCH_TIPDOC", nullable = false, insertable=false, updatable=false)
    @ManyToOne
    private GR_TipoDocumento tipoDocumento;

    //Numero de documento
    @Column(name = "GRTTRA_NRODOC", length = 50)
    private String nrodoc;

    //Telefono
    @Column(name = "GRTTRA_TELEFN", length = 30)
    private String telefn;

    //Numero de fax
    @Column(name = "GRTTRA_NROFAX", length = 20)
    private String nrofax;

    //Responsable
    @Column(name = "GRTTRA_RESPON", length = 20)
    private String respon;
    @Basic(optional = false)

    //Tipo de transporte P=Propio T=Tercero
    @Column(name = "GRTTRA_TIPTRA", nullable = false, length = 1)
    private String tiptra;
    
    @Column(name = "GRTTRA_DEBAJA")
    private Character debaja;

    //Jurisdiccion
    @JoinColumn(name = "GRTTRA_JURISD", referencedColumnName = "GRTJUR_JURISD", nullable = false, insertable=false, updatable=false)
    @ManyToOne
    private GR_Jurisdiccion jurisdiccion;

    //Horario de atencion verano
    @Column(name = "USR_GRTTRA_HATVER", length = 40)
    private String hatver;

    //Horario de atencion invierno
    @Column(name = "USR_GRTTRA_HATINV", length = 40)
    private String hatinv;

    @JoinColumn(name = "USR_GRTTRA_NROCTA", referencedColumnName = "VTMCLH_NROCTA", nullable = false, insertable=false, updatable=false)
    @ManyToOne
    private VT_Cliente cliente;


    public GR_Transporte() {
    }

    public GR_Transporte(String tracod) {
        this.tracod = tracod;
    }

    public GR_Transporte(String tracod, String descrp, String tiptra) {
        this.tracod = tracod;
        this.descrp = descrp;
        this.tiptra = tiptra;
    }

    public GR_CodigoPostal getCodigoPostal() {
        return codigoPostal;
    }

    public void setCodigoPostal(GR_CodigoPostal codigoPostal) {
        this.codigoPostal = codigoPostal;
    }

    public String getDescrp() {
        return descrp;
    }

    public void setDescrp(String descrp) {
        this.descrp = descrp;
    }

    public Character getDebaja() {
        return debaja;
    }

    public void setDebaja(Character debaja) {
        this.debaja = debaja;
    }
    
    public String getHatinv() {
        return hatinv;
    }

    public void setHatinv(String hatinv) {
        this.hatinv = hatinv;
    }

    public String getHatver() {
        return hatver;
    }

    public void setHatver(String hatver) {
        this.hatver = hatver;
    }

    public String getNrodoc() {
        return nrodoc;
    }

    public void setNrodoc(String nrodoc) {
        this.nrodoc = nrodoc;
    }

    public String getNrofax() {
        return nrofax;
    }

    public void setNrofax(String nrofax) {
        this.nrofax = nrofax;
    }

    public String getRespon() {
        return respon;
    }

    public void setRespon(String respon) {
        this.respon = respon;
    }

    public String getTelefn() {
        return telefn;
    }

    public void setTelefn(String telefn) {
        this.telefn = telefn;
    }


    public String getTiptra() {
        return tiptra;
    }

    public void setTiptra(String tiptra) {
        this.tiptra = tiptra;
    }

    public String getTracod() {
        return tracod;
    }

    public void setTracod(String tracod) {
        this.tracod = tracod;
    }

    public String getTradir() {
        return tradir;
    }

    public void setTradir(String tradir) {
        this.tradir = tradir;
    }

    public VT_Cliente getCliente() {
        return cliente;
    }

    public void setCliente(VT_Cliente cliente) {
        this.cliente = cliente;
    }

    public GR_Jurisdiccion getJurisdiccion() {
        return jurisdiccion;
    }

    public void setJurisdiccion(GR_Jurisdiccion jurisdiccion) {
        this.jurisdiccion = jurisdiccion;
    }

    public GR_Pais getPais() {
        return pais;
    }

    public void setPais(GR_Pais pais) {
        this.pais = pais;
    }

    public GR_TipoDocumento getTipoDocumento() {
        return tipoDocumento;
    }

    public void setTipoDocumento(GR_TipoDocumento tipoDocumento) {
        this.tipoDocumento = tipoDocumento;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tracod != null ? tracod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GR_Transporte)) {
            return false;
        }
        GR_Transporte other = (GR_Transporte) object;
        if ((this.tracod == null && other.tracod != null) || (this.tracod != null && !this.tracod.equals(other.tracod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tv.global.modelo.Transporte[grttraTracod=" + tracod + "]";
    }

}
